import {
  Message,
  Loading,
  // MessageBox
} from 'element-ui';
import vLoading from 'project/admin/components/Loading'
export const log = {
  info(msg) {
    Message({
      message: msg,
      type: 'info'
    })
  },
  ok(msg) {
    Message({
      message: msg,
      type: 'success'
    })
  },
  warn(msg) {
    Message({
      message: msg,
      type: 'warning'
    })
  },
  error(msg) {
    Message({
      message: msg,
      type: 'error'
    })
  },
}
// export const messageBox =

export class loading {
  open(text, option) {
    let options = Object.assign({
      text: text || '请求中····',
      spinner:'el-icon-loading',
      background:'rgba(0, 0, 0, 0.8)'
    }, option || {})
    this.loading = Loading.service(options);
  }
  close() {
    this.loading.close();
  }
}

export class vProgress{
  open(){
    this.vLoading = vLoading();
  }
  close(){
    this.vLoading.close()
  }
}
